#include "stdafx.h"
#include "base/system/process_utils.h"
#include "base/system/process_walker.h"

CString GetProcNameById(DWORD nPid)
{
    ProcessWalker oWalker;
    if(!oWalker.Start(nPid)) {
        return _T("");
    }

    PROCESSENTRY32 *pProcEntry = oWalker.Get();
    do {
        if(pProcEntry->th32ProcessID == nPid) {
            return CString(pProcEntry->szExeFile);
        }
    } while(oWalker.Next());

    return _T("");
}
